package controller;

import Utils.ConstantUtils;
import Utils.ResponseData;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import service.SysUserService;

import javax.annotation.Resource;

/**
 * 用户基础信息(SysUser)表控制层
 *
 * @author liujh
 * @since 2020-08-10 17:02:41
 */
@Controller
@RequestMapping(value = "sysUser",produces = {"application/json;charset=UTF-8"})
public class SysUserController {


    /**
     * 服务对象
     */
    @Resource
    private SysUserService sysUserService;




    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     *
     * @return 单条数据
     */
    @GetMapping(value = "selectOne")
    @ResponseBody
    public Object selectOne(Long id) {

        return this.sysUserService.queryById(id);
    }


    @GetMapping(value = "list")
    public Object findList(@RequestParam(name = "pageNum", defaultValue = "1") int pageNum,
                           @RequestParam(name = "pageSize", defaultValue = "5") int pageSize, Model m) {
       sysUserService.queryAllByLimit(pageNum, pageSize,m);
        return "sys/user/list::userlist";
    }


}